package com.crm.system.service.impl;

import java.util.List;
import com.crm.common.utils.DateUtils;
import com.crm.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.crm.system.mapper.BieAdviceMapper;
import com.crm.system.domain.BieAdvice;
import com.crm.system.service.IBieAdviceService;
import com.crm.common.core.text.Convert;

/**
 * 医嘱Service业务层处理
 * 
 * @author lifei
 * @date 2021-05-10
 */
@Service
public class BieAdviceServiceImpl implements IBieAdviceService 
{
    @Autowired
    private BieAdviceMapper bieAdviceMapper;

    /**
     * 查询医嘱
     * 
     * @param adviceId 医嘱ID
     * @return 医嘱
     */
    @Override
    public BieAdvice selectBieAdviceById(String adviceId)
    {
        return bieAdviceMapper.selectBieAdviceById(adviceId);
    }

    /**
     * 查询医嘱列表
     * 
     * @param bieAdvice 医嘱
     * @return 医嘱
     */
    @Override
    public List<BieAdvice> selectBieAdviceList(BieAdvice bieAdvice)
    {
        return bieAdviceMapper.selectBieAdviceList(bieAdvice);
    }

    /**
     * 新增医嘱
     * 
     * @param bieAdvice 医嘱
     * @return 结果
     */
    @Override
    public int insertBieAdvice(BieAdvice bieAdvice)
    {
        bieAdvice.setAdviceId(UUID.randomUUID().toString());
        bieAdvice.setCreateTime(DateUtils.getNowDate());
        return bieAdviceMapper.insertBieAdvice(bieAdvice);
    }

    /**
     * 修改医嘱
     * 
     * @param bieAdvice 医嘱
     * @return 结果
     */
    @Override
    public int updateBieAdvice(BieAdvice bieAdvice)
    {
        return bieAdviceMapper.updateBieAdvice(bieAdvice);
    }

    /**
     * 删除医嘱对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBieAdviceByIds(String ids)
    {
        return bieAdviceMapper.deleteBieAdviceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除医嘱信息
     * 
     * @param adviceId 医嘱ID
     * @return 结果
     */
    @Override
    public int deleteBieAdviceById(String adviceId)
    {
        return bieAdviceMapper.deleteBieAdviceById(adviceId);
    }
}
